package com.cwvs.cat.bean;

import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONArray;

public class MyClub {
	
    public int id;
	public String name;
	public String introduce;
	public String backgroudPicUrl;
	public int owner;
	public int ownerPhoneNumber;
	public String createdTime;
	public int recentNews;
	public String recentNewsContent;
	public String recentNewsPicUrl;
	public int recentActivity;
	public String recentActivityContent;
	public int count;
	public int shopNumber;
	public int status;
	
	public void fromJson(JSONArray json){
		id = json.optInt(0);
		name = json.optString(1);
		introduce = json.optString(2);
		backgroudPicUrl = json.optString(3);
		owner = json.optInt(4);
		ownerPhoneNumber = json.optInt(5);
		createdTime = json.optString(6);
		recentNews = json.optInt(7);
		recentNewsContent = json.optString(8);
		recentNewsPicUrl = json.optString(9);
		recentActivity = json.optInt(10);
		recentActivityContent = json.optString(11);
		count = json.optInt(12);
		shopNumber = json.optInt(13);
		status = json.optInt(14);
	}
	
	public JSONObject toJson(){
		JSONObject json = new JSONObject();
		try {
			json.put("id", id);
			json.put("name", name);
			json.put("introduce",introduce);
			json.put("backgroud_pic", backgroudPicUrl);
			json.put("owner",owner);
			json.put("ownername", ownerPhoneNumber);
			json.put("created", createdTime);
			json.put("recent_news", recentNews);
			json.put("recent_news_content", recentNewsContent);
			json.put("recent_news_pic", recentNewsPicUrl);
			json.put("recent_activit", recentActivity);
			json.put("recent_activit_content", recentActivityContent);
			json.put("count", count);
			json.put("shop",shopNumber);
			json.put("status", status);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return json;
	}
	public static MyClub createFromJson(JSONArray json) {
		MyClub msgSystem = new MyClub();
		msgSystem.fromJson(json);
		return msgSystem;
	}
	
}
